package com.dji.sample.manage.controller;
/**
 * @author 10587
 * @date 2022/9/7
 */

import com.dji.sample.common.util.MinioUtil;
import io.minio.ObjectWriteResponse;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import java.io.IOException;
import java.util.List;

/**
 * @author yjt
 * @date 2022-09-07
 * @description:
 */
@RestController
@RequestMapping("minio")
public class MinioController {

    @Autowired
    MinioUtil minioUtil;

    @PostMapping("/upload")
    public String upload(MultipartFile file) throws IOException {
        minioUtil.upload("add.png", file);
        return "success";
    }

    @PostMapping("/preview")
    public String getPreviewUrl() throws IOException {
        return minioUtil.preview("add.png");
    }
}
